﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace Dragon
{
    public class Services: IServices
    {
        DataService ds = new DataService();

        public void AddDeviceTracking(string imei, string localTime, string networkTime, string lat, string lng, string note)
        {
            string sql = "exec sp_Insert_DeviceTracking @Imei, @LocalTime, @NetworkTime, @Lat, @Lng, @Note";
            SqlParameter pImei = new SqlParameter("@Imei", imei);
            SqlParameter pLocalTime = new SqlParameter("@LocalTime", localTime);
            SqlParameter pNetworkTime = new SqlParameter("@NetworkTime", networkTime);
            SqlParameter pLat = new SqlParameter("@Lat", lat);
            SqlParameter pLng = new SqlParameter("@Lng", lng);
            SqlParameter pNote = new SqlParameter("@Note", note);
            ds.SetData(sql, pImei, pLocalTime, pNetworkTime, pLat, pLng, pNote);
        }
        
        public DataTable GetAllDeviceTracking()
        {
            DataTable dt = ds.GetData("select * from DeviceTracking");
            return dt;
        }       
    }
}